<ol id="sections">
    <li class="section">
        <div class="dp-content">
            <div id="doctor">
                <div id="doctor-left-info">
                    <div id="photo">
                        <div class="main-photo inline-block">
                            <?php include_partial("doctor_show/potrait", array("doctor" => $doctor, "height" => 128)) ?>
                        </div>
                        <div class="inline-block" id="other">
                            <?php include_partial("doctor_show/mini_potraits", array("doctor" => $doctor, "height" => 32)) ?>
                        </div>
                    </div>
                    <div id="info">
                        <h1><?php echo $doctor->getUser() ?></h1>
                        <div class="rating" id="doctor-rating-<?php echo $doctor->getId() ?>">
                            <?php include_partial("rating", array("doctor" => $doctor, "doctorAverageRating" => $doctorAverageRating)) ?>
                        </div>
                        <div class="doctor-actions">
                            <button class="blue-button-30 book-now" type="submit" id="invoke-book-now-form">Book now</button>
                            <button class="blue-button-30 book-now" type="submit" id="invoke-refer-friend-form">Tell a friend</button>
                        </div>
                    </div>
                    
                </div>
                <div id="doctor-right-info">
                    <div class="doctor-row">
                        <div class="doctor-col-left">
                            <div id="practice-details">
                                <h2>
                                    <span class="attribute">Practice name</span>
                                    <span class="value">
                                        <?php echo $doctor->getPracticeName() ?>
                                    </span>
                                </h2>
                            </div>
                            <div id="contact">
                                <h2><span class="attribute">Practice location</span></h2>
                                <ul>                                    
                                    <?php foreach ($doctor->getLocations() as $doctorLocation): ?>
                                        <li>
                                            <?php echo $doctorLocation->getStreetAddress() ?>, <?php echo $doctorLocation->getArea() ?> <?php echo $doctorLocation->getCity() ?> <?php echo $doctorLocation->getPostCode() ?><br/>
                                            <strong>t:</strong> <?php echo $doctorLocation->getPhone() ?> <strong>f:</strong> <?php echo $doctorLocation->getFax() ?>
                                        </li>
                                        <?php break; ?>
                                    <?php endforeach; ?>
                                </ul>
                            </div> 
                            <div id="specialities">
                                <h2><span class="attribute">Specialities</span></h2>
                                <ul>
                                    <?php foreach ($doctor->getSpecialities() as $doctorSpeciality): ?>
                                        <li><?php echo $doctorSpeciality->getSpeciality()->getName() ?></li>
                                    <?php endforeach; ?>
                                </ul>
                            </div>
                        </div>
                        <div class="doctor-col-right">
                            <div id="doctor-search-google-map">
                                <?php include_partial("doctor_location/doctor_google_map", array("doctor" => $doctor)) ?>
                            </div>
                        </div>
                    </div>            
                    <div class="doctor-row border-top">
                        <div class="doctor-col-left" id="average-rating">   
                            <h2><span class="attribute">Average rating</span></h2>
                            <div class="member-ratings">                                
                                <div id="average-rating-panel" class="average-rating inline-block">
                                    <?php include_partial("rating_average", array("doctor" => $doctor, "doctorAverageRating" => $doctorAverageRating)) ?>
                                </div>
                            </div>
                        </div>
                        <div class="doctor-col-right">
                            <div id="medical-insurances">
                                <h2><span class="attribute">Medical Insurances Accepted</span></h2>
                                <ul>
                                    <?php foreach ($doctor->getMedicalInsurances() as $doctorMedicalInsurance): ?>
                                        <li><?php echo $doctorMedicalInsurance->getMedicalInsurance()->getName() ?></li>
                                    <?php endforeach; ?>
                                </ul>
                            </div>
                        </div>
                    </div>
                    <div id="doctor-header">
                        <ul role="navigation" class="tabs clearfix" id="settings_nav">      
                            <li class="active">
                                <a href="javascript:;" tab="doctor-timetable">Schedule</a>				
                            </li>
                            <li>
                                <a href="javascript:;" tab="doctor-Member-reviews">Member Reviews</a>				
                            </li>
                            <li>
                                <a href="javascript:;" tab="doctor-q-and-a">Questions and Answers</a>				
                            </li>
                            <li>
                                <a href="javascript:;" tab="doctor-health-advice">Health Advice</a>				
                            </li>
                        </ul>			
                    </div>
                    <div id="doctor-timetable" class="doctor-body">
                        <div class="doctor-row">
                            <h1 class="choose-time-slot">Choose a time slot below and proceed to make your appointment</h1>
                        </div>
                        <div class="doctor-row">
                            <?php include_partial("appointment/select_field", array("form" => $form, "field" => "appointment_reason_id")) ?>
                        </div>
                        <div class="doctor-row" id="doctor-slots-holder">
                            <div id="doctor-week-slider-controls">
                                <div class="inline-block" id="doctor-prev-week-block">
                                    <button class="button week-action" type="submit" id="prev-week">Prev Week</button>
                                </div>
                                <div class="inline-block" id="doctor-this-week-block">
                                    <button class="button week-action" type="submit" id="this-week">This Week</button>
                                </div>
                                <div class="inline-block" id="doctor-next-week-block">
                                    <button class="button week-action" type="submit" id="next-week">Next Week</button>
                                </div>
                            </div>
                            <?php include_partial("time_slots", array("doctor" => $doctor, "id" => "", "showHeadings" => true)) ?>
                        </div>                         
                    </div>
                    <div id="doctor-Member-reviews" class="doctor-body"> 
                        <div class="doctor-row">
                            <div class=" inline-block">
                                <h2><span class="attribute">Member Reviews</span></h2>
                            </div>
                            <div class=" inline-block">
                                <button class="blue-button-30" type="submit" id="invoke-review-form">Review</button>
                            </div>
                        </div>      
                        <div class="doctor-row">
                            <?php include_partial("doctor_review/reviews", array("doctorReviews" => $doctor->getReviews())) ?>
                        </div>
                    </div>
                    <div id="doctor-q-and-a" class="doctor-body">
                        <div class="doctor-row">
                            <div class=" inline-block">
                                <h2><span class="attribute">Questions And Answers</span></h2>
                            </div>
                            <div class=" inline-block">
                                <button class="blue-button-30" type="submit" id="invoke-question-form">Ask?</button>
                            </div>
                        </div>      
                        <div class="doctor-row" id="doctor-questions-and-answers">
                            <?php include_partial("doctor_question_and_answer/question_and_answers", array("doctorQuestionAndAnswers" => $doctor->getQuestionsAndAnswers())) ?>
                        </div>
                    </div>
                    <div id="doctor-health-advice" class="doctor-body">
                        <div class="doctor-row">
                            <div class=" inline-block">
                                <h2><span class="attribute">Health Advices</span></h2>
                            </div>
                            <div class=" inline-block">
                                <button class="blue-button-30" type="submit" id="invoke-health-advice-form">Advice</button>
                            </div>
                        </div>      
                        <div class="doctor-row" id="doctor-health-advices">
                            <?php include_partial("doctor_health_advice/advices", array("doctorHealthAdvices" => $doctor->getAdvices())) ?>
                        </div>
                    </div>
                </div>
                <div class="clear"></div>
            </div>
        </div>
    </li>
</ol>
<div style="display: none;">
    <div id="book-now-form-holder"></div>
</div>
<div style="display: none;">
    <div id="review-form-holder"></div>    
    <input type="hidden" name="my_doctor_review_id" id="my_doctor_review_id"/>
</div>
<div style="display: none;">
    <div id="health-advice-form-holder"></div>
</div>
<div style="display: none;">
    <div id="refer-friend-form-holder"></div>
</div>
<div style="display: none;">
    <div id="question-form-holder"></div>
</div>
<div style="display: none;">
    <div id="answer-form-holder"></div>
</div>
<script type="text/javascript">
    $(document).ready(function(){    
        // initialise our doctor's slideshow
        $(".slideshow").colorbox({rel:'slideshow', slideshow:true,  "close":closeHtml});        
        
        // automatically load the doctor review form
        $("#review-form-holder").load('/doctor-review-new/<?php echo $doctor->getId() ?>');
        
        // automatically load the doctor advice form
        $("#question-form-holder").load('/doctor-ask/<?php echo $doctor->getId() ?>');   
        
        $("#invoke-health-advice-form").live("click", function(){
            // load the doctor advice form
            $.get('/doctor-health-advice-new', {}, function (data, textStatus){
                if(data == "signin"){
                    showSignInDropDown();
                }
                else{
                    $("#health-advice-form-holder").html(data);
                    $.colorbox({inline:true, width:"700px", height:"500px", href:"#health-advice-form-holder", "close":closeHtml});
                }
            }, 'html');
        });
        
        $("#invoke-refer-friend-form").live("click", function(){
            // load the refer friend form
            $.get('/refer-friend', {}, function (data){
                $("#refer-friend-form-holder").html(data);
                $.colorbox({inline:true, width:"700px", height:"660px", href:"#refer-friend-form-holder", "close":closeHtml});
            }, 'html');
        });
        
        // automatically load the book now time slots
        $("#book-now-box").load('/appointment-book-now/<?php echo $doctor->getId() ?>');
        
        var $sliderContainer = $('#time-slot-inner-slider').cycle({
            fx:     'scrollHorz',
            timeout: 0,
            next:   '#next-week',
            prev: '#prev-week'
        });
        
        $('#this-week').click(function(){
            $sliderContainer.cycle(0);
        });
        
        $('#doctor-header li a').click(function(){
            $(".doctor-body").hide();
            $("#doctor-header li").removeClass("active");
            $(this).parent().addClass("active")
            $("#" + $(this).attr("tab")).show();
        });    
        
        $(".rate-health-advice").live("click", function(){
            $("#health-advice-rating-" + $(this).attr("ratehealthadviceid")).load("/doctor-health-advice-rate/" + $(this).attr("ratehealthadviceid") + "/" + $(this).attr("rating"));
        });   
        
        $(".invoke-answer-form").live("click", function(){            
            // automatically load the doctor question and answer form
            $("#answer-form-holder").load('/doctor-answer/' + $(this).attr("doctorquestionandanswerid"));
        });
        
        // invoke the color boxes
        $("#invoke-book-now-form").colorbox({inline:true, width:"688px", height:"540px", href:"#book-now-form-holder", "close":closeHtml});
        $("#invoke-review-form").colorbox({inline:true, width:"700px", height:"350px", href:"#review-form-holder", "close":closeHtml});
        $("#invoke-question-form").colorbox({inline:true, width:"700px", height:"500px", href:"#question-form-holder", "close":closeHtml});
    });
</script>